// 使用BigInteger应对49选10超出范围的计算

import java.math.BigInteger;
import java.util.Scanner;

public class BigIntegerTest {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            System.out.println("How mary numbers do you need to draw? ");
            int k = in.nextInt();

            System.out.println("What is the highest number you can draw? ");
            BigInteger n = in.nextBigInteger();

            BigInteger lotteryOdds = BigInteger.ONE;
            for (int i = 1; i <= k; i++) {
                lotteryOdds = lotteryOdds.multiply(n.subtract(BigInteger.valueOf(i))).divide(BigInteger.valueOf(i));
            }
            System.out.println("Your odds are 1 in " + lotteryOdds + ". Good luck!");
        }
    }
}
